home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_bigfancydoor.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  184 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_bigfancydoor.cog
  4. #    
  5. # Opens the door to the minecar room in pyramid 1, triggered by messages from the monojackals
  6. #
  7. # [RKD]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13. message    startup
  14. message    user1
  15. message    arrived
  16. message    activated
  17.  
  18. # door parts
  19. thing    lock0        linkid=1
  20. thing    lock1        linkid=1
  21. thing    lock2        linkid=1
  22. thing    lock3        linkid=1
  23. thing    door        nolink
  24. thing    ghosthinge    nolink
  25. thing    sphinx        nolink
  26.  
  27. # cams and camlooks
  28. thing    doorcam            nolink
  29. thing    doorlinecam        nolink
  30. thing    cam1spot        local
  31. thing    cam1look        local
  32.  
  33. sector    adjoinsector    nolink
  34.  
  35. thing    player        local
  36.  
  37. sound    thesebars=pr02j01a.wav    local
  38. sound    dooropen=tem_ldoorr_ldoorl_open_c.wav    local
  39. sound    doorstop=tem_ldoorr_ldoorl_close_c.wav    local
  40.  
  41. int        locknum=0        local
  42. int        dr_colltype        local
  43.  
  44. # subroutines
  45. flex    startscene=0.0        local
  46. flex    endscene=0.0        local
  47. flex    fixcams=0.0            local
  48. end
  49.  
  50. code
  51. startup:
  52.     sleep(.01);
  53.     SetSectorAdjoins(GetThingSector(door), 0);
  54.     SetThingLight(door, '100 87 75', .001, .01);
  55.     SetThingLight(lock0, '100 87 75', .001, .01);
  56.     SetThingLight(lock1, '100 87 75', .001, .01);
  57.     SetThingLight(lock2, '100 87 75', .001, .01);
  58.     SetThingLight(lock3, '100 87 75', .001, .01);
  59.     SetThingLight(sphinx, '100 100 100', .001, .01);
  60.     player = GetLocalPlayerThing();
  61.  
  62.     return;
  63.  
  64. activated:
  65. # ---> door bars
  66.  
  67.     # prepare player
  68.     if (MakeMeStop() == -1) return;
  69.     DeselectWeaponWait(player);
  70.     
  71.     StartCutscene(0);
  72.     
  73.     # setup offset camera
  74.     cam1spot = CreateThing(GetThingTemplate(doorlinecam), doorlinecam);
  75.     cam1look = CreateThing(GetThingTemplate(doorlinecam), doorlinecam);
  76.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  77.     SetCameraLookInterp(2, 0);
  78.     SetCameraPosInterp(2, 0);
  79.     SetCameraFocus(2, cam1spot);
  80.     SetCameraSecondaryFocus(2, cam1look);
  81.     SetCurrentCamera(2);
  82.     ResetCameraFOV(0, 0.0);
  83.     SetCameraLookInterp(2, 1);
  84.     SetCameraPosInterp(2, 1);
  85.     SetCameraInterpSpeed(2, 0.7);
  86.     Sleep(0.01);
  87.     SetCameraFocus(2, doorlinecam);
  88.     SetCameraSecondaryFocus(2, door);
  89.  
  90.     # indy takes note
  91.     PlayVoice(player, thesebars, 1, 1);
  92.     sleep(.5);
  93.  
  94.     # restore camera and get rid of objects
  95.     SetCameraLookInterp(2, 0);
  96.     SetCameraPosInterp(2, 0);
  97.     SetCameraPosition(1, GetThingPos(doorlinecam));
  98.     SetCurrentCamera(1);
  99.     DestroyThing(cam1spot);
  100.     DestroyThing(cam1look);
  101.  
  102.     # finish up
  103.     ClearActorFlags(player, 0x200000);
  104.     EndCutscene();
  105.     return;
  106.  
  107. user1:
  108. # ---> one of the monojackal cogs
  109.     
  110.     # force adjoins back on when cutscene starts
  111.     SetSectorAdjoins(adjoinsector, 1);    
  112.  
  113.     # move one lock every time a message is sent
  114.     call startscene;
  115.  
  116.     SetCameraSecondaryFocus(2, sphinx);
  117.     
  118.     MoveToFrame(lock0[locknum], 1, .5);
  119.     locknum = locknum + 1;
  120.  
  121.     MoveToFrame(doorcam, locknum, .2);
  122.     return;
  123.  
  124. arrived:
  125. # ---> doorlocks
  126.  
  127.     if (GetSenderRef() == lock3)
  128.     {
  129.         # slide camera closer
  130.         MoveToFrame(doorcam, 5, .2);
  131.         Sleep(1);
  132.     
  133.         # opendoor
  134.         dr_colltype = GetCollideType(door);
  135.         SetCollideType(door, 0);
  136.         SetSectorAdjoins(GetThingSector(door), 1);
  137.         AttachThingToThing(door, ghosthinge);
  138.         Rotate(ghosthinge, 90, 1, 3);
  139.         PlaySoundThing(dooropen, door, 1, -1, -1, 0);
  140.         
  141.         WaitForStop(ghosthinge);
  142.         SetCollideType(door, dr_colltype);
  143.         PlaySoundThing(doorstop, door, 1, -1, -1, 0);
  144.         
  145.         sleep(1);
  146.     }
  147.     else
  148.     {
  149.         sleep(1);
  150.     }
  151.     
  152.     call endscene;
  153.     return;
  154.  
  155. startscene:
  156.     call fixcams;
  157.  
  158.     StartCutscene(1);
  159.     SetCameraFocus(2, doorcam);
  160.     SetCameraSecondaryFocus(2, sphinx);
  161.     SetCurrentCamera(2);
  162.     ResetCameraFOV(0, 0);
  163.     StopThing(player);
  164.     SetActorFlags(player, 0x200000);
  165.     
  166.     return;
  167.     
  168. endscene:
  169.     ClearActorFlags(player, 0x200000);
  170.  
  171.     SetCurrentCamera(1);
  172.     EndCutscene();
  173.     return;
  174.  
  175. fixcams:
  176.     # reset camera settings
  177.     ResetCameraFOV(0, 0);
  178.     SetCameraPosInterp(2, 0);
  179.     SetCameraLookInterp(2, 0);
  180.     RestoreExtCam();
  181.     return;
  182.  
  183. end    
  184.